<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>lifetimes</title>
  <script src="../vue.js"></script>
</head>
<body>
  <div id="root">
    {{
      title
    }}
    <button v-on:click="handleClick">click</button>
  </div>
  <script>
    Vue.config.productionTip = false

    var vm = new Vue({
      el: '#root',

      data: {
        title: 'hello'
      },

      methods: {
        handleClick() {
          console.log(this.title)
        }
      },

      beforeCreate() {
        console.log(document.querySelector('#root').innerHTML)
        // console.log(100)
      },      

      // 在页面已经渲染完毕时候调用
      mounted() {
        // console.log(document.querySelector('#root').innerHTML)
        // console.log(this.title)
      }
    })

  </script>
</body>
</html>